import { h } from 'vue';
import { NTag } from 'naive-ui';
import { NImage } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '属性',
    key: 'type',
    align: "center",
    render(row) {
      if (row.type == 1) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('充电宝损坏'),
          },
        );
      } else if (row.type == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('机柜损坏'),
          },
        );
      }
    }
  },{
    title: '设备号',
    key: 'sn',
    align: "center",
  },{
    title: '维修原因',
    key: 'cause',
    align: "center",
  },
  
  {
    title: '维修图片',
    key: 'sitepicture',
    align: "center",
    render(row) {
      return h(
        NImage,
        {
          width: 80,
          height: 80,
          src: row.sitepicture
        },
      );
    },
  }, {
    title: '维修时间',
    key: 'created_time',
    align: "center",
  }, {
    title: '收件人',
    key: 'addressee',
    align: "center",
  }, {
    title: '联系方式',
    key: 'mobile',
    align: "center",
  }, {
    title: '收件地址',
    key: 'address',
    align: "center",
  }, {
    title: '处理状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 3) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('审核不通过'),
          },
        );
      } else if (row.status == 2) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('待审核'),
          },
        );
      } else if (row.status == 4) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('待寄件'),
          },
        );
      }else if (row.status == 5) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('取消申请'),
          },
        );
      }else if (row.status == 6) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('已发件'),
          },
        );
      }
    }
  },
  {
    title: '发件码单号',
    key: 'danhao',
    align: "center",
  },
];
